package com.qqtech.qquan.draw.service;

import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import com.qqtech.core.frame.dao.BaseDao;
import com.qqtech.core.frame.service.BaseServiceImpl;
import com.qqtech.qquan.draw.dao.DrawItemDao;
import com.qqtech.qquan.draw.model.DrawItem;
import com.qqtech.qquan.draw.model.DrawItemQuery;
import com.qqtech.qquan.draw.model.DrawItemVo;

@Service
public class DrawItemServiceImpl extends BaseServiceImpl<DrawItem>
		implements DrawItemService {
	public static final Logger log = LoggerFactory.getLogger(DrawItemServiceImpl.class);
	
	@Resource
	private DrawItemDao drawItemDao;

	@Override
	protected BaseDao<DrawItem> getBaseDao() {
		return drawItemDao;
	}

	@Override
	public DrawItemVo getByCouponId(Integer couponId) {
		DrawItemQuery drawItemQuery=new DrawItemQuery();
		drawItemQuery.setCouponId(couponId);
		List<DrawItemVo> list=drawItemDao.queryList(drawItemQuery);
		if(null!=list&&list.size()>0){
			return list.get(0);
		}
		return null;
	}
	
	@Override
	public Page<DrawItemVo> queryPageListAdmin(DrawItemQuery query, Pageable pageable) {
		return drawItemDao.queryPageListAdmin(query, pageable);
	}
	
}